package demo.access.modifier;

public class FinalClass {
	public static void main(String[] args)
	{
		RunCalculator rc = new RunCalculator();
		rc.print();
	}
	
}

class Calculator {
	final int dime = 10;
	int count = 0;

	Calculator(int i) {
		count = i;
	}
	
	final void finalMethod()
	{
		System.out.println("final method");
	}
}

class RunCalculator {
	public void print()
	{
		final Calculator calc = new Calculator(1);
		// calc = new Calculator(2); // compiler error.
		calc.count = 2; // ok
		// calc.dime = 11; // compiler error.
		System.out.println("dime: " + calc.dime);
	}
}

class SubCalculator extends Calculator
{

	SubCalculator(int i) {
		super(i);
	}
	
//	@Override
//	void finalMethod() {
//		super.finalMethod();
//	}
}